﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pattern.Common;
using Pattern.Model;

namespace Pattern.Data
{
    public static class Deserialize
    {
        public static List<Tuple<SampleList, string>> GetData(string xmlPath)
        {
            var dir = new DirectoryInfo(xmlPath);
            var files = dir.GetFiles();
            var result = new List<Tuple<SampleList, string>>();
            foreach (var f in files)
            {
                var list = Serialization.Deserialize<SampleList>(f.FullName);
                var name = f.Name.Split('.').First();
                result.Add(new Tuple<SampleList, string>(list, name));
            }
            return result;
        }
    }
}
